Add explict unlink of position for realtime KML.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 20 Oct 2006 14:44:58 +0000 (14:44 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 20 Oct 2006 14:44:58 +0000 (14:44 +0000)
git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@2416 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/kml.c

index 3d6f947651b2f95b67051c4f594d78840b248f81..92a5e7fa83a77abdeecb19d7885f163ad9c9dcf3 100644 (file)
@@ -278,6 +278,17 @@ kml_wr_deinit(void)
        fclose(ofd);
 
        if (posnfilenametmp) {
+#if __WIN32__
+               /*
+                * This is gross.
+                * Windows does not offer an atomic rename; we must
+                * explictly remove the destination here which exposes
+                * a window where a polled reader of this file could find
+                * the file to be missing.  Windows readers will simply
+                * have to retry on this case.
+                */
+               unlink(posnfilename);
+#endif
                rename(posnfilenametmp, posnfilename);
                xfree(posnfilenametmp);
                posnfilenametmp = NULL;